package br.edu.fanor.esfinge.dao.impl;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import br.edu.fanor.esfinge.dao.CompartilharDAO;
import br.edu.fanor.esfinge.entity.Compartilhar;

@Stateless(mappedName="ejb/CompartilharDAO")
public class CompartilharDAOImpl implements CompartilharDAO{
	@PersistenceContext
	private EntityManager em;
	
	@Override
	public Compartilhar inserir(Compartilhar compartilhar) {
		em.persist(compartilhar);
		return compartilhar;
	}

	@Override
	public Compartilhar buscarPorId(Long id) {
	
		return em.find(Compartilhar.class, id);
	}

	@Override
	public void remover(Compartilhar compartilhar) {
		em.remove(compartilhar);
		
	}

}
